package com.bw.module_home.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.bw.module_home.databinding.ItemHomeCateBinding
import com.bw.module_home.model.HomeCateEntity

/**
 * 热门服务适配器
 */
class HotServiceAdapter(private val data:MutableList<HomeCateEntity>) :RecyclerView.Adapter<HotServiceAdapter.HotItemViewHolder>(){

    inner class HotItemViewHolder(val homeCateBinding: ItemHomeCateBinding):RecyclerView.ViewHolder(homeCateBinding.root)

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): HotItemViewHolder {
        val itemDataBinding=ItemHomeCateBinding.inflate(LayoutInflater.from(parent.context),parent,false)
        return HotItemViewHolder(itemDataBinding)
    }

    override fun getItemCount(): Int =data.size

    override fun onBindViewHolder(holder: HotItemViewHolder, position: Int) {
        val homeCateEntity = data[position]

        //GlideImageLoader.loadResImage(holder.homeCateBinding.homeCateImg,homeCateEntity.img,holder.homeCateBinding.homeCateImg)
        //holder.homeCateBinding.homeCateTv.text=homeCateEntity.title
        //holder.homeCateBinding.entity=homeCateEntity
        //执行绑定操作
        //holder.homeCateBinding.executePendingBindings()
    }
}